import { Alert } from 'react-native';
import axios from '../../util/http';
export const createPhotos = async formData => {
    try {
        const res = await axios.post('/photos/create', formData, {
            headers: {
                'Content-Type': 'multipart/form-data',
            },
        });
        return res.data;
    } catch (e) {
        Alert.alert('请求失败', e.message.join(';'));
        return null;
    }
};

export const getPhotosList = async where => {
    try {
        const res = await axios.post('/photos/list', { where }, {});
        return res.data;
    } catch (e) {
        Alert.alert('请求失败', e.message);
        return null;
    }
};
export const getPhotosDetailById = async _id => {
    try {
        const res = await axios.get(`/photos/${_id}`);
        return res.data;
    } catch (e) {
        Alert.alert('请求失败', e.message);
        return null;
    }
};
